// RouterMaster Program for PCMod (SERVER)

PROG.PName = "RouterMaster"
PROG.Author = "[GU]|ZLC|thomasfn"

function PROG:Initialize( pl )
	SendClientProgram( pl, "RouterMaster" )
	SendClientWindow( pl, "Main" )
	
	self:PC_Changed( pl )
end

function PROG:Unload()
	
end

function PROG:Think()

end

function PROG:CommandRecieved( ply, command, args )
	if (command == "block_ip") then
		result = ComposePacket( ply, "ROUTER", 0, { "", "block_ip", args[1] }, PData[pc:EntIndex()].Pass )
		//ltext = "Response: " .. DeliveryStatus( result )
	end
	if (command == "unblock_ip") then
		result = ComposePacket( ply, "ROUTER", 0, { "", "unblock_ip", args[1] }, PData[pc:EntIndex()].Pass )
		//ltext = "Response: " .. DeliveryStatus( result )
	end
	if (command == "set_pass") then
		PData[pc:EntIndex()].Pass = args[1]
	end
	if (command == "quit") then
		UnloadProgram( ply )
	end
end

function PROG:PC_Changed( ply )
	pc = ply.CurrentPC
	if (!pc) then return end
	PData[pc:EntIndex()].LPlayer = ply
end

function PROG:PacketRecieved( packet, pc )
	if (!pc) then return end
	ply = PData[pc:EntIndex()].LPlayer

end